package org.example.module_login.controller;

import org.example.module_login.utlis.JWTToken;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * JWTToken 验证接口
 *
 * @author HAJ
 * @since 2025-03-03 15:17:42
 */
@RestController
public class JwtTokenVerifyController {

    @GetMapping("/jwtTokenVerify")
    public void jwtTokenVerify(HttpServletRequest request, HttpServletResponse response){
        String token = request.getHeader("Authorization");
        System.out.println(token);
        if (!JWTToken.verifyToken(token)){
            response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
        }
    }

}
